package com.sxjh.controller.scalereport;

import com.sxjh.common.BaseController;
import com.sxjh.common.Result;
import com.sxjh.entity.param.DailyReportParam;
import com.sxjh.entity.result.DailyReportResult;
import com.sxjh.service.scalereport.ScaleReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/daily/report")
@Api(tags = "磅单日报表")
public class DailyReportController extends BaseController {

  @Autowired
  private ScaleReportService scaleReportService;

  @ApiOperation("焦炭销售日报表")
  @GetMapping("/jt/xs/rbb")
//  @Authorization("cb.finance.list")
  Result<List<DailyReportResult>> jtXsBd(@Validated DailyReportParam param) {
    param.setCategoryId(3);
    return ok(scaleReportService.getDailyReport(param));
  }
  @ApiOperation("焦炭仓库日报表")
  @GetMapping("/jt/ck/rbb")
//  @Authorization("cb.finance.list")
  Result<List<DailyReportResult>> jtCkBd(@Validated DailyReportParam param) {
    param.setCategoryId(3);
    return ok(scaleReportService.getWareHousesReport(param));
  }
  @ApiOperation("甲醇销售日报表")
  @GetMapping("/jc/xs/rbb")
//  @Authorization("cb.finance.list")
  Result<List<DailyReportResult>> jcXsBd(@Validated DailyReportParam param) {
    param.setCategoryId(4);
    return ok(scaleReportService.getDailyReport(param));
  }
  @ApiOperation("焦油加工厂销售日报表")
  @GetMapping("/jyjgc/xs/rbb")
//  @Authorization("cb.finance.list")
  Result<List<DailyReportResult>> jyjgcXsBd(@Validated DailyReportParam param) {
    param.setCategoryId(5);
    return ok(scaleReportService.getDailyReport(param));
  }
  @ApiOperation("苯精制销售日报表")
  @GetMapping("/bjz/xs/rbb")
//  @Authorization("cb.finance.list")
  Result<List<DailyReportResult>> bjzXsBd(@Validated DailyReportParam param) {
    param.setCategoryId(6);
    return ok(scaleReportService.getDailyReport(param));
  }
  @ApiOperation("化产品回收厂销售日报表")
  @GetMapping("/hcphsc/xs/rbb")
//  @Authorization("cb.finance.list")
  Result<List<DailyReportResult>> hcphscXsBd(@Validated DailyReportParam param) {
    param.setCategoryId(7);
    return ok(scaleReportService.getDailyReport(param));
  }
  @ApiOperation("炭黑销售日报表")
  @GetMapping("/th/xs/rbb")
//  @Authorization("cb.finance.list")
  Result<List<DailyReportResult>> thXsBd(@Validated DailyReportParam param) {
    param.setCategoryId(8);
    return ok(scaleReportService.getDailyReport(param));
  }
  @ApiOperation("煤炭采购日报表")
  @GetMapping("/mt/cg/rbb")
//  @Authorization("cb.finance.list")
  Result<List<DailyReportResult>> mtCgBd(@Validated DailyReportParam param) {
    param.setCategoryId(9);
    return ok(scaleReportService.getDailyReport(param));
  }
  @ApiOperation("化工原料采购日报表")
  @GetMapping("/hgyl/cg/rbb")
//  @Authorization("cb.finance.list")
  Result<List<DailyReportResult>> hgylCgBd(@Validated DailyReportParam param) {
    param.setCategoryId(10);
    return ok(scaleReportService.getDailyReport(param));
  }
  @ApiOperation("化工辅料采购日报表")
  @GetMapping("/hgfl/cg/rbb")
//  @Authorization("cb.finance.list")
  Result<List<DailyReportResult>> hgflCgBd(@Validated DailyReportParam param) {
    param.setCategoryId(11);
    return ok(scaleReportService.getDailyReport(param));
  }
}
